package com.v5.mr.saltotal;
import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Reducer;

public class SalaryTotalReducer extends Reducer<LongWritable, LongWritable, LongWritable, LongWritable> {

	@Override
	protected void reduce(LongWritable k3, Iterable<LongWritable> v3,Context context)
			throws IOException, InterruptedException {
		// 得到v3，代表一个部门中所有员工的薪水
		long total = 0;
		for(LongWritable v:v3){
			total = total + v.get();
		}
		
		//输出  k4 部门号  v4 总额
		context.write(k3, new LongWritable(total));
	}

}
